package com.sgb.member.ui.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.sgb.member.BR;
import com.sgb.member.R;
import com.sgb.member.entity.ClientPerformanceBean;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.PointUtils;
import com.swgk.core.util.StringUtil;

import java.util.List;

public class ClientPerformanceAdapter extends BaseRecycleAdapter<ClientPerformanceBean> {

    public ClientPerformanceAdapter(Context context, List<ClientPerformanceBean> datas) {
        super(context, R.layout.item_client_performance, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final ClientPerformanceBean entity) {
        holder.setBinding(BR.viewModel, entity);
        TextView textView = holder.itemView.findViewById(R.id.tv_price);
        if (!TextUtils.isEmpty(entity.getPrice())) {
            String price = PointUtils.price(Double.parseDouble(entity.getPrice()));
            textView.setText(String.format("%s元", price));
        } else {
            textView.setText("");
        }

    }
}
